/*
 * Copyright (C) 2012 - present Instructure, Inc.
 *
 * This file is part of Canvas.
 *
 * Canvas is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, version 3 of the License.
 *
 * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

@import "base/environment";
@import "pages/shared/move_dialog";

$announcements_disscussion-summary-color: $ic-font-color-dark;

.discussionTopicIndexList {
  .discussion-actions {
    display: inline-block;
    padding: $ic-sp 0 0;
  }
  .discussion-topic {
    cursor: pointer;
    transition: background-color 0.2s;
    padding: $ic-sp/2 $ic-sp;
    border-top: 1px solid $ic-border-light;
    background-color: $ic-color-light;
    display: flex;
    align-items: center;
    // Handle Firefox white space bug that affects .ellipsis class
    @include firefox-white-space-bug-fix;
    @if $use_high_contrast == false {
      &:nth-child(odd) {
        background-color: $lightBackground;
        body.ff & {
          .ellipsis::after { @include firefox-white-space-bug-fix-gradient($lightBackground); }
        }
      }
    }
    &.unread .discussion-title{ font-weight: bold; }
    &.selected {
      background-color: $ic-bg-light-primary;
    }

    .image-block-image {
      float: left;
    }
  }
  .discussion-summary {
    max-width: 740px;
    @media screen and (max-width: 1100px) { max-width: 520px; }
  }

  .discussion-actions-container {
    float: right;
    margin-top: -50px;
  }
  .discussion-unread-container, .discussion-last-reply {
    display: inline-block;
    padding: $ic-sp 10px 0;
    // 'not-important' styles
    color: $announcements_disscussion-summary-color;
    @include fontSize(11px);
  }
  .discussion-info-icons {
    display: inline-block;
    padding: $ic-sp 0 0;
    i {
      padding: 0 $ic-sp/2;
    }
  }
  .discussion-unread-container { width: 56px; }
  .discussion-author { @include fontSize(12px); }
  .discussion-summary { @include fontSize(12px); color: $announcements_disscussion-summary-color; }
  .discussion-title {
    @include fontSize(14px);
    line-height: 1;
    display: block;
    font-weight: bold;
  }
  .discussion-column {
    &.image-block {
      flex: 1;
      align-items: center;
    }
  }
  .toggleSelected { margin: 0 8px 0 0; }
}

.discussion-drag-handle {
  display: none;
  background-image: inline-image('drag_handle.png');
  height: 20px;
  width: 5px;
  background-position: center center;
  background-repeat: no-repeat;
  margin: 0 4px 0 -5px;
  float: left;
  cursor: ns-resize;
  opacity: 0;
  .touch &, .discussion-topic:hover & { opacity: 0.5; }
  .ui-sortable & { display: block; }
  &:hover, &:focus {
    opacity: 1 !important;
  }
}

.discussion-title-block {
  margin: 0;
  line-height: 1.1;
}

.item-box {
  background: #e0e5ea;
  border: 1px solid #c1c7cf;
  border-radius: 3px;
  margin-bottom: 16px;
  padding: 8px 0;

  h1,h2,h3,h4,h5,h6 {
    @include fontSize(16px);
    font-weight: bold;
    line-height: 20px;
    margin: 0 0 8px 16px;

    &, a {
      color: #3a4652;
      text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.75);

      &:hover {
        text-decoration: none;
      }
    }
  }
}

.discussion-collections {
  box-sizing: border-box;
  border: 1px solid $ic-border-light;
  background: $lightBackground;
}

.discussion-list {
  box-sizing: border-box;
  margin-bottom: 12px;
  border: none;

  border-bottom: 1px solid $ic-border-light;
  padding: $ic-sp;
  border-radius: 0;

  &:last-child {
    border-bottom: none;
  }

  &.droppable-hover {
    @if $use_high_contrast {
      box-shadow: inset 0 0 0 2px $ic-link-color;
    }
    @else {
      > * { opacity: 0.5; }
    }
  }

  &.pinned.droppable-hover .no-content {
    background: #dff0d8;
  }

  &.locked .title {
    color: #696969;
  }

  .title-help {
    color: #686868;
    @include fontSize(11px);
    font-style: italic;
  }

  .collectionViewItems {
    margin: 0;
  }

  .loader {
    height: 40px;
  }

  .element_toggler {
    background: none;
    border: none;

    .icon-mini-arrow-down {
      vertical-align: initial;
    }
  }
}

.discussion {
  position: relative;
  display: block;
  height: auto;
  background: $ic-color-light;
  border: 1px solid $ic-border-light;
  border-radius: $baseBorderRadius;
  padding: ($ic-sp - 4) 0 ($ic-sp - 4) $ic-sp;
  color: $ic-font-color--subdued;

  &:after {
    clear: both;
    content: "";
    display: table;
  }

  &:hover {
    background: $ic-bg-light-primary;
  }

  a {
    display: inline;
    height: auto;
    background: transparent;
    border: none;
    border-radius: 0;
    &.al-trigger { display: inline-block; }
  }

  .discussion-content {
    box-sizing: border-box;
    display: table;
    vertical-align: middle;
    width: 100%;
  }

  .discussion-row {
    display: table-row;

    .mastery-path-icon {
      margin-right: 10px;
      padding: 2px 7px;
      font-size: 0.8em;

      i {
        margin-right: 5px;
      }
    }

    > div {
      display: table-cell;
      vertical-align: middle;
      &.discussion-title small { white-space: nowrap; }
    }
    &.discussion-unpublished {
      .discussion-type, .discussion-title a {
        color: #696969;
      }
    }
    &.discussion-published {
      .discussion-type {
        color: $ic-color-success;
      }
      .discussion-title a {
        color: $ic-font-color-dark;
      }
    }
  }

  .draggable-handle {
    width: 16px;
    color: #B4B7BA;
    cursor: pointer;
  }

  .discussion-type {
    text-align: center;
    width: 36px;
    padding-right: $ic-sp;
  }

  .discussion-date-available, .discussion-due-date { @include fontSize(12px); }

  .discussion-date-available {
    width: 200px;
    .status-description {
      font-weight: bold;
    }
  }

  .discussion-due-date {
    width: 200px;
    .discussion-date-type {
      font-weight: bold;
    }
  }

  .discussion-status {
    color: $ic-color-icon-disabled;
    width: 84px;
    white-space: nowrap;

    .publish-icon, .lock-icon {
      margin-right: 10px;
    }

    .subscription-toggler {
      @include ic-focus-base;
      padding: 4px;
      &:focus { @include ic-focus-variant; }
      &:before { margin: 0; }
    }

    a[class*=icon-] {
       text-decoration: none;
    }

    .icon-discussion-check {
      color: $ic-color-success;
    }

    .icon-discussion-x {
      color: $ic-color-danger;
    }
  }

  .discussion-unread-status {
    padding-right: 5px;
    width: 60px;
  }

  .discussion-actions {
    width: 48px;
  }

  .title {
    display: block;
    @include fontSize(14px);
    font-weight: bold;
    &:focus {
      outline: 0;
      text-decoration: underline;
    }
  }

  &.no-content {
    border-style: dashed;
    display: none;
    text-align: center;
    margin: $ic-sp/2;
    padding: $ic-sp;
    color: $ic-hint-text;
    border-color: $ic-border-dark;

    &:hover {
      background: #fff;
    }

    b {
      @include fontSize(16px);
    }

    p {
      margin: 0;
    }
  }
}

.accessibility-warning {
  @include accessibility-prompt;
  @include fontSize(14px);
}
